﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StockCrawler
{
    public class CrawlingProcess
    {
        public void Run()
        {
            PrepareCrawling();
            RunCrawling();
        }

        private void PrepareCrawling()
        {
            Console.WriteLine("Preparing for crawling data...");
            using (var context = new StockBiz())
            {
                CrawlingContext.Current.StockList =
                    (from stock 
                     in context.Stocks
                     select stock.Symbol).ToList();
            }
        }

        private void RunCrawling()
        {
            new PriceInfoCrawler().Run();
            new TradingInfoCrawler().Run();
            new ForeignInfoCrawler().Run();
        }
    }
}
